import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * @author whale_fall
 * @date 2019-07-04
 */
public class PC {
   public String recommend() throws IOException {
      String url ="http://api_t.jikexiu.com/v1/promotion/coupon/recommend?orderId=J1854004904562844&isBest=true";
       CloseableHttpClient httpClient = null;
       HttpGet httpGet = null;
       httpGet = new HttpGet(url);//构建HttpPost对象
       httpClient = HttpClients.createDefault();//实例化HttpClient对象
       RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
       httpGet.setConfig(requestConfig);//设置RequestConfig
       CloseableHttpResponse response = httpClient.execute(httpGet);
       HttpEntity httpEntity = response.getEntity();//获取响应正文对象
       return EntityUtils.toString(httpEntity,"utf-8");

   }
}